{% from 'bootstrap/form.html' import render_form %}
{% from 'bootstrap/pagination.html' import render_pagination %}
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>{% block title %}{{ title }}{% endblock %}</title>
		<link type="text/css" rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css') }}" />
		<script type="text/javascript" src="{{ url_for('static',filename='js/bootstrap.min.js')}}"></script>
	    {{ moment.include_moment(local_js=url_for('static',filename='js/moment-with-locales.js')) }}
        <script type="text/javascript" src="{{ url_for('static',filename='js/jquery-3.6.0.min.js') }}"></script>
    </head>
	<body>
    <div class="container-fluid">
        <div class="row">
        <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
        <a class="navbar-brand" href="{{ url_for('blog.home') }}">Blog</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
            <li class="nav-item">
              <a class="nav-link active" href="{{ url_for('blog.home') }}">Home</a>
            </li>
            {% if current_user.is_authenticated  %}
            <li class="nav-item">
              <a class="nav-link" href="{{ url_for('blog.my_blog',user_id=current_user.id) }}">my blog</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{{ url_for('blog.about',user_id=current_user.id) }}">about me</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{{ url_for('blog.write_blog',username=current_user.username) }}">write blog</a>
            </li>
            {% else %}
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.login') }}">my blog</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.login') }}">about me</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.login') }}">write blog</a>
                </li>
            {% endif %}
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                后台管理
              </a>
                <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                    <li><a class="dropdown-item" href="{{ url_for('admin.manage') }}">我的博客</a></li>
                    <li><a class="dropdown-item" href="{{ url_for('admin.my_comment') }}">我的评论</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item" href="#">Something else here</a></li>
              </ul>
            </li>
            {% if current_user.is_authenticated  %}
                <li class="nav-item">
                  <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">welcome {{ current_user.username }}</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.change_password') }}" tabindex="-1" aria-disabled="true">修改密码</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.logout') }}" tabindex="-1" aria-disabled="true">退出登陆</a>
                </li>
            {% else %}
                <li class="nav-item">
                <a class="nav-link " href="{{ url_for('auth.login') }}" tabindex="-1" aria-disabled="true">登陆</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link " href="{{ url_for('auth.register') }}" tabindex="-1" aria-disabled="true">注册</a>
                </li>
            {% endif %}
            </ul>
          <form class="d-flex" method="post" action="{{ url_for('blog.search') }}">
            <input class="form-control me-2" required type="search" placeholder="Search" aria-label="Search" name="q">
            <button class="btn btn-outline-success" type="submit">Search</button>
          </form>
        </div>
        </div>
        </nav>
        </div>
    </div>
    {{ moment.locale(auto_detect=True) }}
	</body>
    {% block body %}
    {% endblock %}
    <div style="margin: 0 auto;text-align: center; margin-bottom: 50px;">
        <a href="http://beian.miit.gov.cn">赣ICP备2021010590号</a>
        <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=36010802000558">
            <img src="{{ url_for('static',filename='assets/beian.png') }}">
            赣公网安备 36010802000558
        </a>
    </div>
{% block script %}
{% endblock %}
</html>
